package controller;

import POJO.DevUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import service.DevUserService;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

/**
 * Created by 任 on 2019/1/15.
 */
@Controller
@RequestMapping("/dev")
public class DevUserController {
    @Resource
    DevUserService devUserService;


    @RequestMapping("/login")
    public String login(){
        return "login2";
    }
    @RequestMapping("/login2")
    public String login(@RequestParam("devName") String devName,
                        @RequestParam("devPassword") String devPassword,
                        HttpSession session){
        DevUser devUser=devUserService.LoginDevUser(devName,devPassword);
if (devUser!=null){
    session.setAttribute("devUser",devUser);
    return "indexss";
}else{
    return "login2";
}

    }
}
